//
// Created by 123 on 2024/12/26.
//
#include "stdio.h"

int main073(){
    FILE* fp;
//    fp = fopen("sample2.txt","r");
//    if(fp == NULL){
//        perror("open file failure");
//        return -1;
//    }
//    fclose(fp);
//    printf("only read success\n");

    fp = fopen("sample.txt","w");
    if(fp == NULL){
        perror("open file failure");
        return -1;
    }
    //写入数据到文件
    fprintf(fp,"hello world");
    if(fclose(fp) != 0){
        perror("file close failure");
        return -1;
    }

    return 0;
}